#!coding=utf-8
from django.db import models
from enterprise_basic_information.models import *

import settings
#表四
#生产使用的危险化学品基本信息

# class Dangerous_chemicals(models.Model):
#     quantity = models.CharField(u'属于危险化学品的产品（数量）',max_length = 30)
#     name = models.CharField(u'商品名',max_length = 30)
#     pollution_node = models.CharField(u'危险化学品名',max_length = 30)
#     whereabouts = models.CharField(u'生产能力(吨/年)',max_length = 30)
#     ability = models.CharField(u'上年度产量(吨/年)',max_length = 30)
#     pollution_node = models.CharField(u'上年度自用量(吨/年)',max_length = 30)
#     whereabouts = models.CharField(u'上年度最大存储量(吨)',max_length = 30)

#表五
#生产使用的危险化学品
class Dangerous_chemicals(models.Model):
    chemical_name = models.CharField(u'危险化学品名',max_length = 30)
    commodity_name = models.CharField(u'商品名',max_length = 30)
    CAS = models.CharField(u'CAS',max_length = 30)
    belong = models.CharField(u'该危险化学品属于',max_length = 30)
    physical_state = models.CharField(u'物理状态',max_length = 30)
    category = models.CharField(u'管理类别',max_length = 30)
    usage = models.CharField(u'预期用途代码',max_length = 30)
    #危险性分类
    tag_copy = models.FileField(u'标签复印件',upload_to= 'static\\upload\\%Y\\%m-%d',null=True,blank=True)
    instruction = models.FileField(u'化学品安全技术说明书',upload_to= 'static\\upload\\%Y\\%m-%d',null=True,blank=True)
    environmental_hazards = models.CharField(u'环境危害',max_length = 30)
    health_hazards = models.CharField(u'健康危害',max_length = 30)
    physical_hazards = models.CharField(u'物理危险',max_length = 30)
    #组分信息
    component_name = models.CharField(u'组分名称',max_length = 30)
    chinese_chemical_name= models.CharField(u'中文化学名称',max_length = 30)
    component_CAS = models.CharField(u'CAS',max_length = 30)
    content = models.CharField(u'含量',max_length = 30)
    #生产使用信息
    type = models.CharField(u'活动类型',max_length = 30)
    production_code = models.CharField(u'所在生产线编号',max_length = 30)
    ability = models.CharField(u'生产能力(吨/年)',max_length = 30)
    design_use = models.CharField(u'设计使用量(吨/年)',max_length = 30)
    three_years_ago_production = models.CharField(u'前三年产量(吨/年)',max_length = 30)
    three_years_ago_use = models.CharField(u'前三年用量(吨/年)',max_length = 30)
    #存储情况
    storage_place_name = models.CharField(u'存储场地名称',max_length = 30)
    max_storage = models.CharField(u'上年度最大储存量（吨）',max_length = 30)
    wrap_type = models.CharField(u'包装方式',max_length = 30)
    total = models.CharField(u'合计',max_length = 30)
    #环境风险分布，防控及应急措施
    danger_site = models.CharField(u'可能产生环境风险的位置',max_length = 30)
    pollution_mode = models.CharField(u'污染方式',max_length = 30)
    emergency_measures = models.CharField(u'环境风险防控及应急措施',max_length = 30)

    enterprise = models.ForeignKey(Enterprise)
    def getObj(self):
        _dict = {}
        _dict["id"] = self.id
        _dict["chemical_name"] = self.chemical_name
        _dict["commodity_name"] = self.commodity_name
        _dict["CAS"] = self.CAS
        _dict["belong"] = self.belong
        _dict["physical_state"] = self.physical_state
        _dict["category"] = self.category
        _dict["usage"] = self.usage

        _dict["instruction"] = self.instruction
        _dict["environmental_hazards"] = self.environmental_hazards
        _dict["health_hazards"] = self.health_hazards
        _dict["physical_hazards"] = self.physical_hazards

        _dict["component_name"] = self.component_name
        _dict["chinese_chemical_name"] = self.chinese_chemical_name
        _dict["component_CAS"] = self.component_CAS
        _dict["content"] = self.content
        #
        _dict["type"] = self.type
        _dict["production_code"] = self.production_code
        _dict["ability"] = self.ability
        _dict["design_use"] = self.design_use
        _dict["three_years_ago_production"] = self.three_years_ago_production
        _dict["three_years_ago_use"] = self.three_years_ago_use
        #
        _dict["storage_place_name"] = self.storage_place_name
        _dict["max_storage"] = self.max_storage
        _dict["wrap_type"] = self.wrap_type
        _dict["total"] = self.total

        _dict["danger_site"] = self.danger_site
        _dict["pollution_mode"] = self.pollution_mode
        _dict["emergency_measures"] = self.emergency_measures
        return _dict
#表六
##生产使用的危险化学品汇总
#class Dangerous_chemicals(models.Model):